import Vue from 'vue'
//import { Cell } from 'mint-ui'
//import { Field } from 'mint-ui'
import global_ from './components/Global.vue'
Vue.prototype.GLOBAL = global_

import { Header } from 'mint-ui';


import { Button, Cell,Field } from 'mint-ui'
import { Radio } from 'mint-ui'
import { Picker } from 'mint-ui'
import { Toast } from 'mint-ui'
import { Search } from 'mint-ui'
import { DatetimePicker } from 'mint-ui';

import { Navbar, TabItem } from 'mint-ui';

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';


import 'mint-ui/lib/style.css'
import App from './App.vue'
import router from './router'
import store from './store'
import Cookies from 'js-cookie'



Vue.component(Header.name, Header);

Vue.component(Navbar.name, Navbar);
Vue.component(TabItem.name, TabItem);

Vue.component(Button.name, Button)
Vue.component(Cell.name, Cell)
Vue.component(Field.name, Field);
Vue.component(Radio.name, Radio);
Vue.component(Picker.name, Picker);
Vue.component(Search.name, Search);
Vue.component(Toast.name, Toast);
Vue.component(DatetimePicker.name, DatetimePicker);




Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App),
  watch:{
    "$route" : 'checkLogin'
    },
  created: {
    created() {
      this.checkLogin();
    },
  },
  methods: {
    checkLogin() {
      //检查是否存在session
      //cookie操作方法在源码里有或者参考网上的即可
      if (Cookies.get('logined')!="on") {
        //如果没有登录状态则跳转到登录页
        
        this.$router.push('/login2');
      } 
    }
  }
}).$mount('#app')
